package com.example.park.weixiu

import android.util.Log
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.viewModelScope
import com.example.lib_base.entity.WeiXiuEntity
import com.example.lib_base.entity.WeiXiuEntityItem
import com.example.lib_base.mvvm.BaseViewModel
import com.example.lib_base.net.ApiService
import dagger.hilt.android.lifecycle.HiltViewModel
import kotlinx.coroutines.launch
import javax.inject.Inject
@HiltViewModel
class WeiXiuViewModel @Inject constructor(val apiService: ApiService):BaseViewModel() {
    val success=MutableLiveData<WeiXiuEntity>()
    val querySuccess =MutableLiveData<WeiXiuEntityItem>()
    val queryRenSuccess =MutableLiveData<WeiXiuEntity>()
    val getWeiXiuXqSuccess=MutableLiveData<WeiXiuEntityItem>()
    val addWeiXiuXqSuccess=MutableLiveData<WeiXiuEntityItem>()
    val delWeiXiuXqSuccess=MutableLiveData<WeiXiuEntity>()
    fun weixiu(){
        httpRequest({apiService.getWeiXiu()},success::postValue)
    }
    fun queryWeiXiu(orderNumber:String){
        httpRequest({apiService.getWeiXiuQuery(orderNumber)},querySuccess::postValue)
    }
    fun queryRenWeiXiu(repairName:String){
        httpRequest({apiService.getWeiXiuQueryRen(repairName)},queryRenSuccess::postValue)
    }
    fun getWeiXiuXq(id:Int){
        httpRequest({apiService.getWeiXiuXq(id)},getWeiXiuXqSuccess::postValue)
    }
    fun delWeiXiuXq(id:Int){
        httpRequest({apiService.delWeiXiu(id)},delWeiXiuXqSuccess::postValue)
    }
    fun addWeiXiuXq(item: WeiXiuEntityItem){
        httpRequest({apiService.addWeiXiu(item)},addWeiXiuXqSuccess::postValue)
    }
}